{extend name="public:index"/}
{block name="title"}{:sysconf('title')}{/block}
{block name="content"}
<body style="background-color:#fff;">
<div class="whtop">
    <div class="top">
        <p class="p1"><a href="javascript:history.back(-1)"></a></p>
        <p class="p2">反馈信息</p>
        <p class="p3"></p>
    </div>
</div>
<div style="height:2.5rem;"></div>
<div style="padding:0 0.5rem;">
    <input type="text" name="title" placeholder="请输入反馈标题" style="display:block;width:97%;line-height:1.6rem;
    border:none;border-bottom:1px solid #eee;padding-left:3%;">
    <textarea name="content" placeholder="请输入反馈信息" style="margin-top:0.5rem;width:97%;resize:none;
    line-height:1.4rem;height:4.2rem;padding-left:3%;border:1px solid #eee;"></textarea>
    <button style="width:100%;height:1.6rem;background-color:#ff0000;color:#fff;border:none;
    margin-top:0.5rem;" type="button" id="submit">提交反馈</button>
</div>
<script>
    $("#submit").click(function () {
        var title = $("input[name=title]").val();
        var content = $("textarea[name=content]").val();
        $.ajax({
            type: "POST",
            url: "{:url('User/feedback')}",
            data: {'title':title,'content':content},
            dataType:"JSON",
            success:function(data){
                if(data.code == 0){
                    layer.msg(data.msg,{icon:6},function () {
                        window.location.href="{:url('User/index')}";
                    });
                }else{
                    layer.msg(data.msg,{icon:5});
                    $("#submit").prop("disabled",false);
                }
            },
            error: function(){
                layer.msg("网络延迟，发送失败");
                $("#submit").prop("disabled",false);
            }
        });
    })
</script>
{/block}